<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>扩展运算符</title>
</head>
<body>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div>
    <div>6</div>
</body>
<script>
    // 扩展运算符可以将数组拆分成以逗号分隔的参数序列
    let ary = ['pink','red','green','gray']
    console.log(...ary);
    // 扩展运算符应用于数组合并
    let arr1 = [12,23,34,45,56]
    let arr2 = [31,32,33,34,35,36]
    // let arr3 = [...arr1,...arr2]
    // console.log(arr3);
    arr1.push(...arr2)
    console.log(arr1);
    // 利用扩展运算符将伪数组转换为真正的数组
    var oDivs = document.getElementsByTagName('div')
    // oDivs.push('a')
    console.log(oDivs);

    var arr = [...oDivs]
    arr.push('a')
    console.log(arr);
    // console.log(...oDivs);
    // 伪数组不能使用数组的一些方法，push,pop...


</script>
</html>